<%= javascript_include_tag :defaults %>
<h1>Upload new images</h1>

<% form_tag({:action=>'create'}, :multipart => true, :onsubmit => '$("upload_submit_progress").show()') do %>
    <% 1.upto(5) do %>
        <p><input type="file" name="picture_files[]" /></p>
    <% end %>
    <br>
    <p>Tags for these images:</p>
    <p><input type="text" name="tags" id="tags" size="100"></p>

    <p>Group:</p>

    <p>
       <div id='drop_down_div'>
       <% @groups = Group.find(:all, :conditions => ["user_id = ?", Goldberg.user.id])%>
        <select id='group_drop_down' name='group[id]'  >
            <% @groups.each do |group|%>
                <% if group.id.to_s == @group_id.to_s %>
                    <option value = <%=group.id%> selected="selected" > <%=group.name%> </option>
                <% else %>
                    <option value = <%=group.id%> > <%=group.name%> </option>
                <% end %>
            <% end %>
            <option value = "New Group">New Group</option>

        </select>
     </div>


    </p>
    <div id ="new_group">
    <%  if @groups.empty? %>
        <%= render :partial => 'groups/form'%>
    <% end %>
    </div>




<br/>


<input name="commit" type="submit" value="Upload"/>
<%= image_tag "progress_bar.gif", :style => "display:none;", :id => "upload_submit_progress" %>

<% end %>

<%= link_to 'Back', :action => 'list' %>

<%= observe_field "group_drop_down",
                    :update => "new_group",
                    :url => "/groups/new_group_ajax",
                    :with => "group_id"%>


